#include "Timer_drv.h"
#include "Timer_para.h"

/**
 * @brief This function initialize the registers for Timer1
 *
 * @param None
 *
 * @reval None
 */
inline static void Timer1_Config(void)
{


	TIM1->CNT = Tim1CNT;
	TIM1->PSC = Tim1PSC;
	TIM1->ARR = Tim1ARR;

	TIM1->SMCR = Tim1SMCR;
	TIM1->DIER = Tim1DIER;
	TIM1->EGR = Tim1EGR;
	TIM1->CCMR1 = Tim1CCMR1;
	TIM1->CCMR2 = Tim1CCMR2;
	TIM1->CCER = Tim1CCER;

	TIM1->CR2 = Tim1CR2;
	TIM1->CR1 = Tim1CR1;


	return;
}


/**
 * @brief This function initialize the registers for Timer8
 *
 * @param None
 *
 * @reval None
 */
inline static void Timer8_Config(void)
{


	TIM8->CNT = Tim8CNT;
	TIM8->PSC = Tim8PSC;
	TIM8->ARR = Tim8ARR;

	TIM8->SMCR = Tim8SMCR;
	TIM8->DIER = Tim8DIER;
	TIM8->EGR = Tim8EGR;
	TIM8->CCMR1 = Tim8CCMR1;
	TIM8->CCMR2 = Tim8CCMR2;
	TIM8->CCER = Tim8CCER;

	TIM8->CR2 = Tim8CR2;
	TIM8->CR1 = Tim8CR1;


	return;
}

/**
 * @brief This function initialize the registers for Timer2
 *
 * @param None
 *
 * @reval None
 */
inline static void Timer2_Config(void)
{


	TIM2->CNT = Tim2CNT;
	TIM2->PSC = Tim2PSC;
	TIM2->ARR = Tim2ARR;

	TIM2->SMCR = Tim2SMCR;
	TIM2->DIER = Tim2DIER;
	TIM2->EGR = Tim2EGR;
	TIM2->CCMR1 = Tim2CCMR1;
	TIM2->CCMR2 = Tim2CCMR2;
	TIM2->CCER = Tim2CCER;

	TIM2->CR2 = Tim2CR2;
	TIM2->CR1 = Tim2CR1;


	return;
}

inline static void Timer5_Config(void)
{


	TIM5->CNT = Tim5CNT;
	TIM5->PSC = Tim5PSC;
	TIM5->ARR = Tim5ARR;

	TIM5->SMCR = Tim5SMCR;
	TIM5->DIER = Tim5DIER;
	TIM5->EGR = Tim5EGR;
	TIM5->CCMR1 = Tim5CCMR1;
	TIM5->CCMR2 = Tim5CCMR2;
	TIM5->CCER = Tim5CCER;

	TIM5->CR2 = Tim5CR2;
	TIM5->CR1 = Tim5CR1;

	return;
}

inline static void Timer3_Config(void)
{


	TIM3->CNT = Tim3CNT;
	TIM3->PSC = Tim3PSC;
	TIM3->ARR = Tim3ARR;

	TIM3->SMCR = Tim3SMCR;
	TIM3->DIER = Tim3DIER;
	TIM3->EGR = Tim3EGR;
	TIM3->CCMR1 = Tim3CCMR1;
	TIM3->CCMR2 = Tim3CCMR2;
	TIM3->CCER = Tim3CCER;

	TIM3->CR2 = Tim3CR2;
	TIM3->CR1 = Tim3CR1;


	return;
}

inline static void Timer4_Config(void)
{


	TIM4->CNT = Tim4CNT;
	TIM4->PSC = Tim4PSC;
	TIM4->ARR = Tim4ARR;

	TIM4->SMCR = Tim4SMCR;
	TIM4->DIER = Tim4DIER;
	TIM4->EGR = Tim4EGR;
	TIM4->CCMR1 = Tim4CCMR1;
	TIM4->CCMR2 = Tim4CCMR2;
	TIM4->CCER = Tim4CCER;

	TIM4->CR2 = Tim4CR2;
	TIM4->CR1 = Tim4CR1;


	return;
}

inline static void Timer6_Config(void)
{


	TIM6->CNT = Tim6CNT;
	TIM6->PSC = Tim6PSC;
	TIM6->ARR = Tim6ARR;

	TIM6->SMCR = Tim6SMCR;
	TIM6->DIER = Tim6DIER;
	TIM6->EGR = Tim6EGR;
	TIM6->CCMR1 = Tim6CCMR1;
	TIM6->CCMR2 = Tim6CCMR2;
	TIM6->CCER = Tim6CCER;

	TIM6->CR2 = Tim6CR2;
	TIM6->CR1 = Tim6CR1;


	return;
}

inline static void Timer7_Config(void)
{


	TIM7->CNT = Tim7CNT;
	TIM7->PSC = Tim7PSC;
	TIM7->ARR = Tim7ARR;

	TIM7->SMCR = Tim7SMCR;
	TIM7->DIER = Tim7DIER;
	TIM7->EGR = Tim7EGR;
	TIM7->CCMR1 = Tim7CCMR1;
	TIM7->CCMR2 = Tim7CCMR2;
	TIM7->CCER = Tim7CCER;

	TIM7->CR2 = Tim7CR2;
	TIM7->CR1 = Tim7CR1;


	return;
}

inline static void Timer9_Config(void)
{


	TIM9->CNT = Tim9CNT;
	TIM9->PSC = Tim9PSC;
	TIM9->ARR = Tim9ARR;

	TIM9->SMCR = Tim9SMCR;
	TIM9->DIER = Tim9DIER;
	TIM9->EGR = Tim9EGR;
	TIM9->CCMR1 = Tim9CCMR1;
	TIM9->CCMR2 = Tim9CCMR2;
	TIM9->CCER = Tim9CCER;

	TIM9->CR2 = Tim9CR2;
	TIM9->CR1 = Tim9CR1;


	return;
}

inline static void Timer10_Config(void)
{


	TIM10->CNT = Tim10CNT;
	TIM10->PSC = Tim10PSC;
	TIM10->ARR = Tim10ARR;

	TIM10->SMCR = Tim10SMCR;
	TIM10->DIER = Tim10DIER;
	TIM10->EGR = Tim10EGR;
	TIM10->CCMR1 = Tim10CCMR1;
	TIM10->CCMR2 = Tim10CCMR2;
	TIM10->CCER = Tim10CCER;

	TIM10->CR2 = Tim10CR2;
	TIM10->CR1 = Tim10CR1;


	return;
}

inline static void Timer11_Config(void)
{


	TIM11->CNT = Tim11CNT;
	TIM11->PSC = Tim11PSC;
	TIM11->ARR = Tim11ARR;

	TIM11->SMCR = Tim11SMCR;
	TIM11->DIER = Tim11DIER;
	TIM11->EGR = Tim11EGR;
	TIM11->CCMR1 = Tim11CCMR1;
	TIM11->CCMR2 = Tim11CCMR2;
	TIM11->CCER = Tim11CCER;

	TIM11->CR2 = Tim11CR2;
	TIM11->CR1 = Tim11CR1;


	return;
}


inline static void Timer12_Config(void)
{


	TIM12->CNT = Tim12CNT;
	TIM12->PSC = Tim12PSC;
	TIM12->ARR = Tim12ARR;

	TIM12->SMCR = Tim12SMCR;
	TIM12->DIER = Tim12DIER;
	TIM12->EGR = Tim12EGR;
	TIM12->CCMR1 = Tim12CCMR1;
	TIM12->CCMR2 = Tim12CCMR2;
	TIM12->CCER = Tim12CCER;

	TIM12->CR2 = Tim12CR2;
	TIM12->CR1 = Tim12CR1;


	return;
}

inline static void Timer13_Config(void)
{


	TIM13->CNT = Tim13CNT;
	TIM13->PSC = Tim13PSC;
	TIM13->ARR = Tim13ARR;

	TIM13->SMCR = Tim13SMCR;
	TIM13->DIER = Tim13DIER;
	TIM13->EGR = Tim13EGR;
	TIM13->CCMR1 = Tim13CCMR1;
	TIM13->CCMR2 = Tim13CCMR2;
	TIM13->CCER = Tim13CCER;

	TIM13->CR2 = Tim13CR2;
	TIM13->CR1 = Tim13CR1;


	return;
}


inline static void Timer14_Config(void)
{


	TIM14->CNT = Tim14CNT;
	TIM14->PSC = Tim14PSC;
	TIM14->ARR = Tim14ARR;

	TIM14->SMCR = Tim14SMCR;
	TIM14->DIER = Tim14DIER;
	TIM14->EGR = Tim14EGR;
	TIM14->CCMR1 = Tim14CCMR1;
	TIM14->CCMR2 = Tim14CCMR2;
	TIM14->CCER = Tim14CCER;

	TIM14->CR2 = Tim14CR2;
	TIM14->CR1 = Tim14CR1;


	return;
}


void Timer_Init(void)
{
	Timer1_Config();
	Timer2_Config();
	Timer3_Config();
	Timer4_Config();
	Timer6_Config();
	Timer7_Config();
	Timer8_Config();
	Timer9_Config();
	Timer10_Config();
	Timer11_Config();
	Timer12_Config();
	Timer13_Config();
	Timer14_Config();
	return;
}
